package extend2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86156
 * Date: 2023-04-11
 * Time: 12:58
 */

public class Test {
    public static void main(String[] args) {
        // 利用无参构造方法创建子类对象
        Zi z1 = new Zi();

        // 利用有参构造方法创建子类对象
        //Zi z2 = new Zi("zhangsan",18);
        // 报错 因为子类不继承父类的构造方法
    }
}

class Fu {
    String name;
    int age;

    public Fu() {
    }
    public Fu(String name, int age) {
        this.name = name;
        this.age = age;
    }
}

class Zi extends Fu{

}
